<%--
  Created by IntelliJ IDEA.
  User: TJX
  Date: 2023-07-20
  Time: 15:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>注册页面</title>
  </head>
  <body>
    <form action="" method="post">
      手机号：<input name="phone" id="phone"  />
      <input type="button" value="获取验证码" onclick="send()" /><br/>
      验证码：<input name="code" id="code" onblur="checkCode()"  />
      <span id="msg"></span>
    </form>
  </body>
<script src="js/jquery.js"></script>
<script>
  //检查验证码
  function checkCode() {
    $.get("CheckSMSCodeServlet?code="+$("#code").val(),function (data) {
      if(data=="true"){
        $("#msg").html("✔")
      }else{
        $("#msg").html("✘")
      }
    })
  }
  //发送短信验证码
  function send() {
    $.get("SendSMSServlet?phone="+$("#phone").val(),function (data) {
      if(data=="true"){
        alert("短信验证码发送成功，请查收！")
      }else{
        alert("短信验证码发送失败！")
      }
    })
  }
</script>
</html>
